Page({
  data: {
    //验证窗口开关
    verify: false,
    //验证输入的名字
    name: null,
    //输入的提现金额
    money: null,
    //待结算金额
    waitMoney: 10000.01,
    //可提现金额
    winMoney: 50000.88,
    //扣除手续费
    taxMoney: 0.00,
  },
  getsr: function(e){
    var _this = this
    var mon = e.detail.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
    console.log(mon) 
    var shui = (mon/1000)*6
    var newshui = shui.toFixed(2);
    _this.setData({
      money: mon,
      taxMoney: newshui
    })
  },
  //提现
  gowin: function(){
    var _this = this
    var mon = _this.data.money
    var winmon = _this.data.winMoney
    if (mon > winmon) {
      wx.showToast({
        title: '提现金额不足',
        icon: 'none',
        duration: 1500
      })
    } else {
      if (parseInt(mon) < 2) {
        wx.showToast({
          title: '金额需大于2元',
          icon: 'none',
          duration: 1500
        })
      } else if (parseInt(mon) > 20000){
        wx.showToast({
          title: '金额不超过2万',
          icon: 'none',
          duration: 1500
        })
      }else{
        _this.setData({
          verify: true
        })
      }
    }
  },
  //关闭验证窗口
  closeverify: function(){
    var _this = this
    _this.setData({
      verify: false,
      name: null
    })
  },
  //获取验证输入的名字
  getUserName: function(e){
    var _this = this
    var name = e.detail.value.replace(/\s+/g, '')
    _this.setData({
      name: name
    })
  },
  //提交验证
  yesname: function(){
    wx.showToast({
      title: '请稍后',
      icon: 'loading',
      duration: 1500
    })
    var _this = this
    _this.setData({
      verify: false,
      name: null
    })
  }
})